﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Clinica_Frba.Registro_Resultado_Atencion
{
    public partial class Atender : Form
    {
        public Atender()
        {
            InitializeComponent();
        }
        int atencion;
        public Atender(int idat)
        {
            InitializeComponent();
            atencion = idat;
        }
        private void Atender_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sint = "'" + textBox1.Text + "'";
            string enfe = "'" + textBox2.Text + "'";
            SqlConnection myConnection = new SqlConnection(publico.ConnectionString);
            myConnection.Open();
            SqlCommand ins = new SqlCommand("UPDATE DUNDER_MIFFLIN.ATENCION SET ESTADO='A',Sintomas='" + textBox1.Text + "',enfermedades='" + textBox2.Text + "' WHERE ID_ATENCION=" + atencion, myConnection);
            ins.ExecuteNonQuery();
            SqlCommand sel = new SqlCommand("SELECT ID_TURNO FROM DUNDER_MIFFLIN.ATENCION WHERE ID_ATENCION=" + atencion, myConnection);
            Form f = new Clinica_Frba.Generar_Receta.AltaRecetas(sel.ExecuteScalar().ToString());
            f.Show();            
            this.Close();
        }
    }
}
